import {RouteRecordRaw} from 'vue-router'

export default function (framework: any, meta: Record<string, unknown>): RouteRecordRaw {
    meta.cache = true
    return {
        name: 'goods', path: '/goods', component: framework,
        children: ((pre) => [
            {
                name: `${pre}list`, path: 'list', meta: {...meta, title: '商品列表'},
                component: () => import(`@/views/mall/goods/Goods.vue`)
            },
            {
                name: `${pre}add`, path: 'add', meta: {...meta, title: '发布商品'},
                component: () => import('@/views/mall/goods/GoodsForm.vue')
            },
            {
                name: `${pre}edit`, path: 'edit', meta: {...meta, title: '编辑商品'},
                component: () => import('@/views/mall/goods/GoodsForm.vue')
            },
            {
                name: `${pre}cat`, path: 'cat/list', meta: {...meta, title: '商品分类'},
                component: () => import('@/views/mall/goods/GoodsCat.vue')
            },
            {
                name: `${pre}brand`, path: 'brand/list', meta: {...meta, title: '品牌列表'},
                component: () => import('@/views/mall/goods/GoodsBrand.vue')
            },
            {
                name: `${pre}model`, path: 'model/list', meta: {...meta, title: '商品模型'},
                component: () => import('@/views/mall/goods/GoodsModel.vue')
            },
            {
                name: `${pre}model-add`, path: 'model/add', meta: {...meta, title: '添加-商品模型'},
                component: () => import('@/views/mall/goods/GoodsModelForm.vue')
            },
            {
                name: `${pre}model-edit`, path: 'model/edit', meta: {...meta, title: '编辑-商品模型'},
                component: () => import('@/views/mall/goods/GoodsModelForm.vue')
            },
            {
                name: `${pre}gather`, path: 'gather', meta: {...meta, title: '商品采集'},
                component: () => import('@/views/mall/goods/GoodsGather.vue')
            },
        ])('goods-')
    }
}